<!--
 * @Author: 陈迪秀 1170776994@qq.com
 * @Date: 2024-02-23 13:53:59
 * @LastEditors: lg
 * @LastEditTime: 2024-03-02 11:31:29
 * @FilePath: \stell-mall\src\App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <header-layout v-if="classARouter"></header-layout>
  <div class="container">
    <router-view></router-view>
  </div>
  <footer-layout></footer-layout>
  <FloatingWindow />
</template>
<script setup lang="ts">
import HeaderLayout from '@/components/layout/header.vue';
import FooterLayout from '@/components/layout/footer.vue';
import FloatingWindow from '@/components/floating-window/index.vue';
import { useWatchRouter } from '@/hooks/use-router/index';
import { ref, watch } from 'vue';
const { classARouter } = useWatchRouter();
const tablist = [
  {
    text: 'ERP  系列',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AWS5P6T1WH.png',
    children: [
      { text: '供应链云', url: '/Supplychaincloud' },
      { text: '生产云', url: '/shengchanyun' },
      { text: '质量云', url: '/cloud' },
      { text: '安全、环保云', url: '/Security' },
      { text: 'PLM', url: '/PLM' },
      { text: 'CRM', url: '/CRM' },
      { text: '人力云', url: '/humanresources' },
      { text: 'OA办公', url: '/office' },
      { text: '设备云', color: 'grey' },
      { text: '财务云', url: '/finance' },
      { text: '管理驾驶舱', url: '/cockpit' },
      { text: '零件集配系统', color: 'grey' }
    ]
  },
  {
    text: '云助手系列',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AN20KWW0M8.png',
    children: [
      { text: '生产云助手', url: '/shengchanyun' },
      { text: '督小秘-督办管理云助手', url: '/duxiaomi' },
      { text: '履约保-合同管理云助手', url: '/lvyuebao' }
    ]
  },
  {
    text: '人力资源服务',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AX2GBC6X8H.png',
    children: [
      { text: '人力资源规划', url: '/Human' },
      { text: '绩效管理体系设计', url: '/performance' },
      { text: '薪酬管理体系设计', url: '/paylist' },
      { text: '招聘体系建设', url: '/recruits' },
      { text: '岗位胜任力模型构建', url: '/Competency' },
      { text: '人才培养及发展', url: '/personnel' }
    ]
  },
  {
    text: '企业服务',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AX5ZAGP754.png',
    children: [
      { text: '企业诊断', url: '/EnterpriseDiagnosis' },
      { text: '战略规划', url: '/strategy' },
      { text: '股权激励咨询', url: '/stock' },
      { text: '组织体系设计与优化', url: '/organization' },
      { text: '法律咨询', url: '/law' },
      { text: '财税咨询', url: '/financeandtax' }
    ]
  },
  {
    text: '租赁服务',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AX95ZSGAA8.png',
    children: [
      { text: '设备租赁服务', color: 'grey' },
      { text: '工装租赁服务', color: 'grey' }
    ]
  },
  {
    text: '管家服务',
    icon: 'https://gggj.oss-cn-hangzhou.aliyuncs.com/220609AXB40PTM5P.png',
    children: [
      { text: '技术服务', url: '/technology' },
      { text: '科技咨询服务', url: '/science' },
      { text: '体系认证', url: '/system' },
      { text: '检测服务', url: '/testingservice' },
      { text: '劳务服务', url: '/labor' }
    ]
  }
];
let getChildArr = tablist
  .map((item) => item.children)
  .flat(Infinity)
  .map((item) => item.url)
  .filter((item) => item && item);
// .map(item=>item.slice(1))
console.log(getChildArr);
/**
 * @description: 处理老商城有些页面进不去的问题
 * @return {*}
 */
watch(
  () => window.location.href,
  (newValue: any) => {
    console.log(newValue, '监听当前路由');
    let pathname = window.location.pathname;
    if (newValue === 'https://www.gggj.net/inquiry') {
      window.location.href = 'https://www.gggj.net/old-mall/#/inquiry';
    } else if (newValue === 'https://www.gggj.net/about') {
      window.location.href = 'https://www.gggj.net/about-us';
    } else if (
      getChildArr.includes(pathname) &&
      !newValue.includes('old-mall')
    ) {
      let arr = newValue.split('?');
      window.location.href = `https://www.gggj.net/old-mall/#${pathname}?${arr[1]}`;
    }
  },
  { immediate: true }
);
</script>

<style lang="scss" scoped>
#app {
  padding: 0;
}
.container {
  min-height: 600px;
}
</style>
